/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package py.una.pol.ii.is2.domain.flota;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author markos
 */
@Entity
@Table(name = "modelo")
@NamedQueries({@NamedQuery(name = "Modelo.findAll", query = "SELECT m FROM Modelo m"), @NamedQuery(name = "Modelo.findByModeCod", query = "SELECT m FROM Modelo m WHERE m.modeCod = :modeCod"), @NamedQuery(name = "Modelo.findByModeNombre", query = "SELECT m FROM Modelo m WHERE m.modeNombre = :modeNombre"), @NamedQuery(name = "Modelo.findByModeDescripcion", query = "SELECT m FROM Modelo m WHERE m.modeDescripcion = :modeDescripcion")})
public class Modelo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="modelo_generator")
    @SequenceGenerator(name="modelo_generator", sequenceName="modelo_mode_cod_seq",allocationSize=1)
    @Basic(optional = false)
    @Column(name = "mode_cod")
    private Integer modeCod;
    @Basic(optional = false)
    @Column(name = "mode_nombre")
    private String modeNombre;
    @Basic(optional = false)
    @Column(name = "mode_descripcion")
    private String modeDescripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelo")
    private Collection<MarcaModelo> marcaModeloCollection;

    public Modelo() {
    }

    public Modelo(Integer modeCod) {
        this.modeCod = modeCod;
    }

    public Modelo(Integer modeCod, String modeNombre, String modeDescripcion) {
        this.modeCod = modeCod;
        this.modeNombre = modeNombre;
        this.modeDescripcion = modeDescripcion;
    }

    public Integer getModeCod() {
        return modeCod;
    }

    public void setModeCod(Integer modeCod) {
        this.modeCod = modeCod;
    }

    public String getModeNombre() {
        return modeNombre;
    }

    public void setModeNombre(String modeNombre) {
        this.modeNombre = modeNombre;
    }

    public String getModeDescripcion() {
        return modeDescripcion;
    }

    public void setModeDescripcion(String modeDescripcion) {
        this.modeDescripcion = modeDescripcion;
    }

    public Collection<MarcaModelo> getMarcaModeloCollection() {
        return marcaModeloCollection;
    }

    public void setMarcaModeloCollection(Collection<MarcaModelo> marcaModeloCollection) {
        this.marcaModeloCollection = marcaModeloCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (modeCod != null ? modeCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Modelo)) {
            return false;
        }
        Modelo other = (Modelo) object;
        if ((this.modeCod == null && other.modeCod != null) || (this.modeCod != null && !this.modeCod.equals(other.modeCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.una.pol.ii.is2.dao.flota.Modelo[modeCod=" + modeCod + "]";
    }

}
